19:53:50 Here the output date is 16th number Sql> Connect sys/[email protected] as SysdbaConnected.Sql> Select To_char (sysdate, ' Dd-mon-yy HH24:MI:SS ') from dual; To_char (sysdate, ' dd-mon-yyhh24:mi:ss ')------------------------------------------------------16-oct-14 19:53:58 Sql>![[Email protected] ~]$ DateThu Oct 19:54:06 akdt Here the output date is 16th number To view the database alert log: Fri Oct 11:51:57 CST Stop Date is 17th numberALTER DATABASE DismountCompleted:alter DATABASE
sys/[email protected] as SysdbaConnected.Sql> Select To_char (sysdate, ' Dd-mon-yy HH24:MI:SS ') from dual;To_char (sysdate, ' dd-mon-yyhh24:mi:ss ')------------------------------------------------------16-oct-14 19:53:58Sql>![[Email protected] ~]$ DateThu Oct 19:54:06 akdt Here the output date is 16th numberTo view the database alert log:Fri Oct 11:51:57 CST Stop Date is 17th numberALTER DATABASE DismountCompleted:alter DATABASE DismountArch:archival disabled due to shutdown:1089Shutting dow
Some function records of Oracle to_char.
1. Convert to year, month, day, hour, minute, and second;
2. Turning it into a subtle operation
SQL> select to_char (systimestamp, 'yyyy-mm-dd-hh24: mi: ss. ff') from dual;TO_CHAR (SYSTIMESTAMP, 'yyyy-MM-------------------------------2013-09-26-16:08:04. 234000
Note that the parameter format is not converted to millisecond
be 0 to 9. The default value is 6:
Select systimestamp, systimestamp (9) from dual;4.2 to_date (c, [fmt]) 4.3 to_timestamp (c, [fmt]) 4.4 to_number (c, [fmt]) 5. Grouping Function
There are two groups in Oracle: group by and partition:
Group by emphasizes a whole, that is, a group. Only one record meeting the aggregate function can be displayed in a group. parti
; shutdown immediateDatabase closed.Database dismounted.Oracle instance shut down.Change the time zone to +SQL> startupOracle instance started.
Total system global area 131145064Bytes
Fixed size 453992Bytes
Variable Size 109051904Bytes
Database buffers 20971520Bytes
Redo Buffers' 667648
Bytes
Database mounted.Database opened.SQL> select sysdate from dual;
Sysdate---------02-aug-06
SQL> alter session set nls_date_format = 'yyyy-mm-dd hh24: MI: ss ';
Session altered.
SQL> select sysdate from dual;
, starting at m and intercepting N characters consecutively.---need to note: The database subscript is starting from 1!!!---n is truncated to the end of the current string if the number that is not specified or specified exceeds the actual character length that can be intercepted. n is the length.---if M is negative, it is intercepted from the countdown position. The number at the end cannot be negative.SELECT SUBSTR (' thinking in from dual;--->inSELECT SUBSTR (' thinking in from dual;--->in---
collection a={a,b}, set b={0,1,2}, the Cartesian product of two sets is {(a,0), (a,1), (a,2), (b,0), (b,1), (b,2)}. Can be extended to multiple collections of cases.Nine, set connectionX. expansion1. CMD Console Login to Oracle database: Sqlplus scott/[email protected]2. Get the current time--Select To_char (sysdate, ' Yyyy-mm-dd hh24:mi:ss ') from dual;Output result value: 2011-11-30 19:40:55Gets the current time (decimal point is accurate to the ba
manager of 1.SMITH is FORD The manager of 2.ALLEN is BLAKE The manager of 3.WARD is BLAKE Note: In the operation of multi-table joint query, if the following conditions occur, the Cartesian product will be formed – The join condition is omitted – Invalid Join condition – All rows in the first table are joined to all rows in the second table To avoid Cartesian product, always include valid join conditions What is Cartesian product? The product of Descartes (Descartes) is also called direct pr
all rows in the second tableTo avoid Cartesian product, always include valid join conditionsWhat is Cartesian product?The product of Descartes (Descartes) is also called direct product. Assuming collection a={a,b}, set b={0,1,2}, the Cartesian product of two sets is {(a,0), (a,1), (a,2), (b,0), (b,1), (b,2)}. Can be extended to multiple collections of cases.Nine, set connectionX. expansion1. CMD Console Login to Oracle database: Sqlplus scott/[email
Today in the operation of the database, found that the data operation error, want to recover, but no transaction, supposedly, set to not default commit transaction, at this time the various operations do not respond to the database. At this point, you can rollback the transaction and undo any uncommitted changes. However, once a commit is made, there is really no way to undo it. Fortunately, Oracle also has a timestamp method.The first method:1. Open
Label:1, the use of dual tableDual is a physically existing table in Oracle that can be read by any user, often in a SELECT statement block without a target table--View current connected userConnected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0Connected as SYSSql> Select User from dual;USER------------------------------SYSTEM--View current date, timeSql> select
1. CharA fixed-length string is a string that is stored in the database with spaces filled with insufficient digits. The declaration method is as follows: Char (L). L is the string length. The default value is 1 and the maximum value is 2000. It is not recommended for use, which may cause unnecessary troubles.A. errors may occur if you do not pay attention to the character string comparison (the char is not filled with spaces ).B. When comparing strings, if the trim function is used, the index o
is extract (year [mounth] [day] from time object). For example:
Select extract (year from sysdate) from dual;
(7) use the trunc function to change the hour, minute, and second to 00:00:00.
For example,
Select to_char (trunc (sysdate), 'yyyy-mm-dd hh24: mi: ss') from dual;
(8) use the round function to make a trade-off (after 12 hours, enter 1 );
For example,
Select to_char (round (sysdate), 'yyyy-mm-dd hh24: mi: ss') from dual;
(9) least (date1, date2) returns a relatively old time object
1.2
object), for exampleSelect Extract (year from sysdate) from dual;(7) Use Trunc function bar to change to 00:00:00For exampleSelect To_char (trunc (sysdate), ' Yyyy-mm-dd Hh24:mi:ss ') from dual;(8) use the round function to trade-offs (after a few, then into 1);For exampleSelect To_char (Round (sysdate), ' Yyyy-mm-dd Hh24:mi:ss ') from dual;(9) least (DATE1,DATE2) returns more ancient time objects1.2 Oracle Timestamp () timestamp object for more pre
In the development of Oracle databases, it is often a matter of time, so the date function of Oracle data is collected specifically. is for future investigation.
Add_months (d,n) Date d plus n months
Last_day (d) The date of the last day of the month that contains D
New_time (D,A,B) The date of the area A and?? d The date in area B and??
Next_day (D,day) than Date d?, day of the week specified by day
Sysdat
of the time object. The format is extract (year [mounth] [day] from time object). For example:
Select extract (year from sysdate) from dual;
(7) use the trunc function to change the hour, minute, and second to 00:00:00.
For example,
Select to_char (trunc (sysdate), 'yyyy-mm-dd hh24: mi: ss') from dual;
(8) use the round function to make a trade-off (after 12 hours, enter 1 );
For example,
Select to_char (round (sysdate), 'yyyy-mm-dd hh24: mi: ss') from dual;
(9) least (date1, date2) returns a r
Date functionDate functions manipulate Date values (fields of date type), timestamp values (TIMESTAMP, TIMESTAMP with time ZONE, and TIMESTAMP with the fields of the local time ZONE type), and interval values (INTERVAL day to SECOND and INTERVAL year to MONTH).
Most date functions, such as add_months, Current_date, Last_day, New_time, and Next_day, are designed for Oracle date types. If you provide a timestamp value as their parameter, the
Label:In the work I encountered such a problem, the session table needs to use the timestamp field, in the timestamp field updates appear as a problem, such as the need to increase the duration of the session 1 hours.The use of Systimestamp + 1/24 will lose the accuracy of the second, the feeling increases after the appearance of the date type. A study has found that Oracle has a function calledNumtodsinter
Tags: database oracle Oracle RAC Snapshot DBAStatspack is the product of the Oracle 9i ERA, and is the predecessor of AWR, which has a cross-milestone significance for monitoring and analyzing database performance. After the Oracle 10g, AWR replaced the statspack. Nonetheless, Statpack is still a good choice if the AWR
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.